{% set children_formset = form["children"] %}
{% set product_type = "subscription" if subscription else "package" %}

{% for mf in children_formset.management_form %}{{ mf|safe }}{% endfor %}
<div class="list-group package-product">
    {% for child_form in children_formset %}
        <div class="list-group-item">
            <div class="cells">
                <div class="line-cell">
                    <label>{% trans %}Product{% endtrans %}</label>
                    {% for field in child_form.hidden_fields() %}{{ field|safe }}{% endfor %}
                    {{ bs3.field(child_form.child) }}
                </div>
                <div class="line-cell">
                    <label>{% trans %}Quantity{% endtrans %}</label>
                    {{ bs3.field(child_form.quantity) }}
                </div>
                <div class="line-cell delete">
                    <label>{% trans %}Delete{% endtrans %}</label>
                    {% if child_form.DELETE and child_form.initial.child %}{{ bs3.field(child_form.DELETE) }}{% endif %}
                </div>
            </div>
            {% set stocks = child_form.get_stock_statuses(request.user) %}
            {% for supplier, stock_status, sales_decimals, sales_unit in stocks.values() %}
                <strong>{{ supplier.name }}:</strong>
                <span>
                {% trans logical_count=stock_status.logical_count|floatformat(sales_decimals), sales_unit=sales_unit -%}
                    Logical count: {{ logical_count }} {{ sales_unit }}
                {%- endtrans %}
                </span>
                <span>
                {% trans physical_count=stock_status.physical_count|floatformat(sales_decimals), sales_unit=sales_unit -%}
                    Physical count: {{ physical_count }} {{ sales_unit }}
                {%- endtrans %}
                </span>
            {% endfor %}
            {% for error in child_form.get_orderability_errors(request.user) %}
                <p><small class="text-danger">{{ error }}</small></p>
            {% endfor %}
        </div>
    {% endfor %}
</div>
